(function(g,b,d){var c=b.head||b.getElementsByTagName("head"),D="readyState",E="onreadystatechange",F="DOMContentLoaded",G="addEventListener",H=setTimeout;
	function f(){
	   $LAB
	   .script("https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js").wait()
	   //see http://code.google.com/p/crypto-js 
	   .script("https://crypto-js.googlecode.com/files/2.5.3-crypto-md5.js").wait()
	   .script("assets/js/bootstrap.min.js")
	   .script("assets/js/app.js")
	   .script("assets/js/passwordgen.js")
	   .script("assets/js/url_module.js")
	   .script("assets/js/template.js")
	   .wait(function() {
		//worth looking @ http://twitter.github.com/hogan.js/ {js templating}
			$(function() {
				//bound to document
				//app.subscribe($(), "passwordGenerated", function(x) {document.title = x;})
				//error handled
				//app.subscribe($("#result"), "passwordGenerated", function(password) {password.security();});
				// more subscribers! 
				//app.subscribe($("#result"), "passwordGenerated", function(password) {console.log(password);});
				app.subscribe($("#result"), "passwordGenerated", function(password) {
					$(this).html(template.get("password", {"url" : url.clean($("#dom").val()), "password": password})).removeClass("hide");
				});
			});

			$(document).on("click", function(e) {
				if ($(e.target).is("#generate")) {
					e.preventDefault();
					$("div.progress").removeClass("hide").css("width", "10%");
					var $this = $(this),
						domainkey = $this.find("input[type=text]"), 
						pass = $this.find("input[type=password]");
					if (pass.val().length && domainkey.val().length)
					{
						app.publish("passwordGenerated", passgen.pub({ key : pass.val(), domain : domainkey.val()}));			
					}
				}	
			});
	   });
	 }
H(function(){if("item"in c){if(!c[0]){H(arguments.callee,25);return}c=c[0]}var a=b.createElement("script"),e=false;a.onload=a[E]=function(){if((a[D]&&a[D]!=="complete"&&a[D]!=="loaded")||e){return false}a.onload=a[E]=null;e=true;f()};
a.src="assets/js/LAB.min.js";c.insertBefore(a,c.firstChild)},0);if(b[D]==null&&b[G]){b[D]="loading";b[G](F,d=function(){b.removeEventListener(F,d,false);b[D]="complete"},false)}})(this,document);